﻿using System;

using CrudServices;
using CrudServices.WebApi.Server;
using CrudServices.EF;

using Northwind.DataLayer.EF;
using Northwind.Model;

namespace Server.Controllers
{
    public class NorthwindDataController : CrudApiController
    {
        protected override ICrudService CreateImplementation()
        {
            Type productType = typeof(Product);
            return new CrudServiceEF<NorthwindContext>(name => {
                string entityTypeName = string.Format("{0}.{1}, {2}", productType.Namespace, name, productType.Assembly.FullName);
                return Type.GetType(entityTypeName, false, false);
            });
        }
    }
}
